package team.sun.sss.controller.staff;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import team.sun.sss.dao.staff.*;
import team.sun.sss.pojo.staff.*;
import team.sun.sss.service.staff.StaffServiceImpl;
import team.sun.sss.service.user.UserServiceImpl;

@Controller
public class StaffAddController {

    @Autowired
    StaffServiceImpl staffService;
    @Autowired
    UserServiceImpl userService;
    @Autowired
    StaffCertificateDao staffCertificateDao;
    @Autowired
    StaffCourseDao staffCourseDao;
    @Autowired
    StaffRewardDao staffRewardDao;
    @Autowired
    StaffTrainDao staffTrainDao;
    @Autowired
    StaffTakeStudentDao staffTakeStudentDao;
    @Autowired
    StaffThesisDao staffThesisDao;
    @Autowired
    StaffDao staffDao;

    //带学生情况新增
    @PostMapping("/take_student_add")
    public String takeStudentUpdate(@ModelAttribute(value = "staffTakeStudent")StaffTakeStudent staffTakeStudent){
        staffTakeStudentDao.addStaffTakeStudent(staffTakeStudent);
        return "redirect:/staff_update/"+staffTakeStudent.getStaNum();
    }
    //奖励情况新增
    @PostMapping("/reward_add")
    public String rewardAdd(@ModelAttribute(value = "staffReward") StaffReward staffReward){
        staffRewardDao.addStaffReward(staffReward);
        return "redirect:/staff_update/"+staffReward.getStaNum();
    }
    //职业培训新增
    @PostMapping("/train_add")
    public String trainAdd(@ModelAttribute(name = "staffTrain")StaffTrain staffTrain){
        staffTrainDao.addStaffTrain(staffTrain);
        return "redirect:/staff_update/"+staffTrain.getStaNum();
    }

    //职业资格证书新增
    @PostMapping("/cert_add")
    public String certAdd(@ModelAttribute(name = "staffCertificate") StaffCertificate staffCertificate){
        staffCertificateDao.addStaffCertificate(staffCertificate);
        return "redirect:/staff_update/"+staffCertificate.getStaNum();
    }

    //论文发表情况新增
    @PostMapping("/thesis_add")
    public String thesisAdd(@ModelAttribute(name = "staffThesis") StaffThesis staffThesis){
        staffThesisDao.addStaffThesis(staffThesis);
        return "redirect:/staff_update/"+staffThesis.getStaNum();
    }

    //教学情况新增
    @PostMapping("/course_add")
    public String thesisAdd(@ModelAttribute(name = "staffCourse") StaffCourse staffCourse){
        staffCourseDao.addStaffCourse(staffCourse);
        return "redirect:/staff_update/"+staffCourse.getStaNum();
    }
}
